<template>
  <div class="yingmoo-store">
    <ul class="nav">
      <router-link tag="li" to="/ymMemberstore">媒体管理</router-link>
      <router-link tag="li" to="/ymMemberstorecomboaddsubmit">套餐管理</router-link>
      <router-link tag="li" to="/ymMembermysubmitactivity">我的活动</router-link>
      <router-link tag="li" to="/ymMembersubmitmycase">我的案例</router-link>
      <router-link tag="p" to="/ymMemberstorecomboadd" class="uploading"><img src="../assets/ym-member/media/return.png" />返回</router-link>
    </ul>
    <div class="cont">
      <h4>媒体列表</h4>
      <div>
        <p>媒体分类</p>
        <select name="" class="sel">
          <option value="" selected="selected"></option>
        </select>
        <div class="soso">
          <input type="text" placeholder="请输入媒体名称的关键词" />
          <div class="btn"><span>搜索</span></div>
        </div>
      </div>
    </div>
    <div class="content">
     <div class="model">
       <dl @mouseenter='' @mouseleave='shos=0' v-for="media in mediaList">
         <dt><img :src="media.cover" /></dt>
         <input class="mediaCheck" type="checkbox" name="check" :value="media.mediaId"/>
         <label for="mediaCheck"></label>
         <div>
           <h3>{{media.mediaName}}</h3>
           <dd>{{media.address}}<span><!--{{v.here}}--></span></dd>
           <!--<dd>{{v.this}}<span>{{v.is}}</span></dd>-->
           <dd>刊例价：<span>{{media.prices}}{{media.lightStyleId}}</span></dd>
         </div>
         <!--<div class="shade" @mouseenter='shos=v.num' @mouseleave='shos=0' v-show='shos==v.num'></div>-->
       </dl>
     </div>
     <div class="model2">
     	  <div class="" @click="showSelected">确定</div>
     </div>
    </div>
    <!--  分页器  -->
    <div class="paging">
      <el-pagination
        :page-size="10"
        background
        layout="prev, pager, next, jumper"
        :total="1000">
      </el-pagination>
    </div>
  </div>
</template>

<script>
  export default {
    name: "yingmoo-store",
    data() {
      return {
      	reuqestAddr:this.GLOBAL.addr,
        shos: 0,
        user:'',
        mediaList:[],
        model: [{
          name: '媒体标题媒体标题媒体标题',
          where: '机场媒体',
          here: '灯箱',
          this: '北京',
          is: '海淀区',
          days: '1345元/天',
          num: '1'
        }]
      }
    },
    mounted(){
    	this.getMedia();
    },
    methods:{
    	
    	getMedia:function(){
    		sessionStorage.removeItem("comboMediaIds")
    		this.user = JSON.parse(localStorage.getItem("user"))
    		this.$http.post(this.reuqestAddr+"/GetJson/getMediaInfo",this.user,{emulateJSON:true}).then(
    			(res)=>{
    				console.log(res.data.mediaList)
    				this.mediaList = res.data.mediaList;
    			}
    		)
    	},
    	//获取被选中的复选框中的值，并返回一个数组
			multSelect:function(){
				var options = document.getElementsByName("check");
				var mediaIds = new Array();
				var index = 0;
				if(options.length<=0){
					alert("请先选择相关商品数据！")
					return;
				}
				for (var i = 0; i<options.length;i++) {
					if(options[i].checked == true){
						mediaIds[index] = options[i].value;
						index++;
					}
				}
				return mediaIds;
			},
			showSelected:function(){
				var selected = this.multSelect();
				var length = selected.length
				if(length<2){
					alert("至少选中两个媒体！")
					return
				}
				sessionStorage.setItem("comboMediaIds",selected)
				window.location.href = "../#/ymMemberstorecomboadd"
			}
			
    }
  }

</script>

<style scoped lang="less">

  .yingmoo-store {
    width: 100%;
    .nav {
      width: 1200px;
      height: 46px;
      margin: 0 auto;
      display: flex;
      align-items: center;
      background-color: #f2f2f2;
      margin-top: 20px;
      li {
        list-style: none;
        width: 90px;
        height: 30px;
        margin: 0 20px;
        line-height: 30px;
        color: #666666;
        text-align: center;
        font-size: 16px;
        cursor: pointer;
        &:hover {
          background-color: #036eb7;
          color: white;
        }
        &:nth-child(2) {
          background-color: #036eb7;
          color: white;
        }
      }
      .uploading {
        width: 103px;
        height: 30px;
        font-size: 14px;
        line-height: 30px;
        color: #999999;
        text-align: center;
        margin-left: 560px;
        cursor: pointer;
        img {
          position: relative;
          top: 5px;
          margin-right: 10px;
        }
      }
    }
    .cont {
      width: 1200px;
      background-color: white;
      margin: 0 auto;
      display: flex;
      h4 {
        font-size: 16px;
        color: #333333;
        font-weight: bold;
        padding-left: 40px;
        padding-top: 40px;
      }
      div {
        width: 990px;
        height: 37px;
        padding-left: 50px;
        padding-top: 30px;
        p {
          font-size: 14px;
          color: #333333;
          line-height: 37px;
          margin-right: 30px;
          float: left;
        }
        .sel {
          float: left;
          width: 289px;
          height: 37px;
        }
        .soso {
          float: right;
          width: 300px;
          height: 36px;
          border: 1px solid #dddddd;
          border-right: none;
          padding-left: 0;
          padding-top: 0;
          display: flex;
          align-items: center;
          margin-top: 0;
          input {
            width: 240px;
            height: 28px;
            border: none;
            padding-left: 15px;
          }
          .check_btn {
            width: 59px;
            height: 38px;
            color: white;
            background-color: #f29600;
            padding-left: 0;
            padding-top: 0;
            font-size: 14px;
            line-height: 38px;
            span {
              padding-left: 15px;
            }
          }
          .btn{
            width: 140px;
            text-align: center;
            margin-top: 0;
            padding-top: 0;
            line-height: 37px;
            margin-left: 40px;
            padding-left: 0;
            background-color: #f29600;
            color: white;
          }
        }
      }
    }
    .content {
      width: 1200px;
      height: 1000px;
      background-color: white;
      margin: 0 auto;
      padding-bottom: 30px;
      .model {
        width: 840px;
        margin: 0 auto;
        position: relative;
        padding-bottom: 35px;
        dl {
          width: 412px;
          height: 117px;
          border: 1px solid #dddddd;
          position: relative;
          float: left;
          margin-right: 12px;
          margin-top: 24px;
          &:nth-child(even){
            margin-right: 0;
          }
          dt {
            float: left;
            img{
              width: 182px;
              height: 117px;
            }
          }
          div {
            float: right;
            margin-right: 30px;
            h3 {
              line-height: 30px;
              font-size: 14px;
              font-weight: bold;
              color: #333333;
            }
            dd {
              line-height: 27px;
              font-size: 14px;
              color: #999999;
            }
          }
          .shade {
            width: 412px;
            height: 117px;
            background: rgba(39, 39, 39, 0.6);
            position: absolute;
            top: 0;
            border: 1px solid #f4c579;
          }
        }
        .mediaCheck{
					position: absolute;
					right: 0px;
					background-color: white;
			    border-radius: 5px;
			    border:1px solid #d3d3d3;
			    width:25px;
			    height:25px;
			    display: inline-block;
			    text-align: center;
			    vertical-align: middle;
			    line-height: 25px;
				}
      }
      .model2{
      	clear: both;
      	width: 840px;
        margin: 0 auto;
        text-align: center;
        padding-top: 50px;
        div{
        	width: 103px;
        	height: 30px;
        	background-color: #f29600;
	        color: white;
	        text-align: center;
	        line-height: 30px;
	        border-radius: 7px;
	        cursor: pointer;
        }
      }
      .check_btn{
        width: 103px;
        height: 30px;
        background-color: #f29600;
        color: white;
        text-align: center;
        line-height: 30px;
        border-radius: 7px;
        margin-left: 190px;
      }
    }
    .paging {
      width: 1200px;
      height: 35px;
      margin: 23px auto;
      text-align: center;
    }
  }

</style>
